<template>
  <el-drawer class="position-absolute" :before-close="handleClose" :visible.sync="isDrawer" direction="rtl"
    :modal="false">
    <template v-if="openType == 'start'">
      <startDialog :capList="listData" v-if="openType == 'start'" @addMessage="addMessage"></startDialog>
    </template>
    <template v-if="openType == 'open'">
      <modelOn :capList="listData" v-if="openType == 'open'" @addMessage="addMessage"></modelOn>
    </template>
    <template v-if="openType == 'close'">
      <modelClose :capList="listData" v-if="openType == 'close'" @addMessage="addMessage"></modelClose>
    </template>
    <template v-if="openType == 'update'">
      <parmUpdata :capList="listData" v-if="openType == 'update'" @addMessage="addMessage"></parmUpdata>
    </template>
    <template v-if="openType == 'timer'">
      <onTimer :capList="listData" v-if="openType == 'timer'" @addMessage="addMessage"></onTimer>
    </template>
    <template v-if="openType == 'logic'">
      <logic :capList="listData" v-if="openType == 'logic'" @addMessage="addMessage"></logic>
    </template>
  </el-drawer>
</template>

<script>
import startDialog from './startDialog.vue'
import modelOn from './modelOn.vue'
import modelClose from './modelClose.vue'
import parmUpdata from './parmUpdata.vue'
import onTimer from './onTimer.vue'
import logic from './logic.vue'
export default {
  components: {
    startDialog,
    modelOn,
    modelClose,
    parmUpdata,
    onTimer,
    logic
  },
  props: {
    flowId: {
      type: String,
      default: ""
    },
    listData: {
      type: String,
      default: ""
    },
  },
  data () {
    return {
      openType: '', //弹窗类型
      isDrawer: false,
      // listData: ''
    }
  },
  mounted () {
    // console.log(this.openType)
    // console.log(this.listData)
  },
  methods: {
    addMessage (val) {
      let mes = {
        DataId: this.flowId,
        desc: JSON.stringify(val)
      }
      this.$emit('saveMessage', mes)
    },
    handleClose () {
      this.openType = ''
      this.isDrawer = false
    }
  }
}
</script>

<style></style>
